<?php

namespace addons\cash;

use app\common\library\Menu;
use think\Addons;

/**
 * 插件
 */
class Cash extends Addons
{

    /**
     * 插件安装方法
     * @return bool
     */
    public function install()
    {
        $menu = [
            [
                'name'    => 'fund_management',
                'title'   => '资金管理',
                'icon'    => 'fa fa-money',
                'sublist' => [
                    [
                        'name'    => 'cash',
                        'title'   => '提现管理',
                        'icon'    => 'fa fa-arrow-circle-o-down',
                        'sublist' => [
                            ["name"  => "cash/index","title" => "查看"],
                            ["name"  => "cash/add","title" => "添加"],
                            ["name"  => "cash/edit","title" => "编辑"],
                            ["name"  => "cash/del","title" => "删除"],
                            ["name"  => "cash/multi","title" => "批量更新"],
                            ["name"  => "cash/check","title" => "审核"],
                        ]
                    ],
                    [
                        'name'    => 'cash_account',
                        'title'   => '提现账号管理',
                        'icon'    => 'fa fa-list-alt',
                        'sublist' => [
                            ["name"  => "cash_account/index","title" => "查看"],
                            ["name"  => "cash_account/add","title" => "添加"],
                            ["name"  => "cash_account/edit","title" => "编辑"],
                            ["name"  => "cash_account/del","title" => "删除"],
                            ["name"  => "cash_account/multi","title" => "批量更新"],
                        ]
                    ]
                ]
            ]
        ];
        Menu::create($menu);
        return true;
    }

    /**
     * 插件卸载方法
     * @return bool
     */
    public function uninstall()
    {
        Menu::delete('fund_management');
        return true;
    }

    /**
     * 插件启用方法
     * @return bool
     */
    public function enable()
    {
        Menu::enable("fund_management");
        return true;
    }

    /**
     * 插件禁用方法
     * @return bool
     */
    public function disable()
    {
        Menu::disable("fund_management");
        return true;
    }

}
